#include<bits/stdc++.h>
using namespace std;
int read()
{
	int x=0;
	char ch;
	ch=getchar();
	while(ch<'0'||ch>'9')
		ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x;
}
int n,m;
int a[1005][1005];
int b[1005][1005];
int main()
{
	int i,j,tot=0,ans=0;
	n=read();
	m=read();
	tot=n*m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		a[i][j]=read();
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(i==1||j==1||i==n||j==m)
			{
				printf("%.1f ",(double)a[i][j]);
			}
			else printf("%.1f ",(double)(a[i][j]+a[i-1][j]+a[i+1][j]+a[i][j-1]+a[i][j+1])/5);
		}
		printf("\n");
	}
	return 0;
}
